[paramiko] Update to 5.0.0#15907
Conversation
This comment has been minimized.
This comment has been minimized.
AlexWaygood
left a comment
There was a problem hiding this comment.
Partial review, I haven't reviewed stubs/paramiko/paramiko/pkey.pyi and onwards yet
| def from_file(cls, flo: Iterable[str]) -> Self: ... | ||
| def parse(self, file_obj: Iterable[str]) -> None: ... |
There was a problem hiding this comment.
while it's true that any iterable of strings will work at runtime, the docstrings say that a file-like object is expected, and IO[str] does express that it should be an iterable of lines (rather than an iterable of words or characters).
I know you're generally opposed to using IO, though, and I share your philosophy there... not sure if there's a protocol that could also express "this needs to be an iterable of lines of source code" in the same way...
There was a problem hiding this comment.
Well, Iterable[str] is explicitly named for situations like this by the Python docs, but then that section was also written be me IIRC, so make of it what you will.
That said, maybe for now we could add a type alias to _typeshed and at some point this might become something more.
| from paramiko.pkey import PKey | ||
| from paramiko.pkey import PKey, _HasReadlines | ||
|
|
||
| _VerifyKey: TypeAlias = Any # actually nacl.signing.VerifyKey |
There was a problem hiding this comment.
pynacl looks to be fully typed and has a py.typed file. We could consider adding it to the stub_uploader allowlist and then adding it as a dependency of these stubs.
There was a problem hiding this comment.
I've just confirmed that paramiko depends on pynacl so that is viable, and probably wouldn't have much of a negative impact in practice. That said, considering that this looks to be the only place where the stubs pynacl and this is more of an internal module, an optional dependency like I suggested #15549 would be a better fit here, in my opinion.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Closes: #15749